home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Languguage OS 2
/
Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO
/
gnu
/
amiga
/
bmake15.lzh
/
TEST-Makefile
< prev
next >
Wrap
Makefile
|
1991-10-14
|
3KB
|
115 lines
# Just for testing
#
# To debug, run the resulting make utility with the following arguments
# bmake -a -d -n -v9 +l -f TEST-Makefile
# the log file make.log will contain a detailed account of what the
# program attempted to do.
#
.jj.k: ; echo "jj to k suffix rule"
.SUFFIXES: .jj .k
aaaaaa = 1
A = aaa
B := $(A)$(A)
C := $($(B))
# This one is cool.
SRCS := $(wildcard #?.c)
OBJS := $(subst .c,.o,$(SRCS))
LIBS := -lben
# Test some of the function calls
SSRC := $(filter s%,$(SRCS))
WILD := $(wildcard #?.c)
BASE := $(basename $(WILD))
ASUF := $(addsuffix .x,$(BASE))
APRE := $(addprefix foo-,$(BASE))
NAPRE := $(words $(APRE))
# test nested conditionals
ifndef (DOIT)
ifdef (undefined)
undefined := $(strip $(undefined))
else
undefined := undefined
endif
DOIT = $(undefined)
endif
doodah:
@echo "$$ $C $$"
@echo "SOURCES:"
@echo "$(SRCS)"
@echo ""
@echo "OBJECTS:"
@echo "$(OBJS)"
@echo ""
@echo "SOURCES starting in s:"
@echo "$(SSRC)"
@echo ""
@echo "replacing ee with EE:"
@echo "$(subst ee,EE,feet on the street)"
@echo ""
@echo "$$(wildcard #?.c)"
@echo "$(WILD)"
@echo ""
@echo "basenames of the above filenames"
@echo "$(BASE)"
@echo ""
@echo "add suffix .x to the above basenames"
@echo "$(ASUF)"
@echo ""
@echo "add prefix foo- to the above basenames"
@echo "$(APRE)"
@echo "find the first word in the above foo-list"
@echo "$(firstword $(APRE))
@echo "find the last word in the above foo-list"
@echo "$(word $(NAPRE),$(APRE))
@echo "sorted list of filenames"
@echo "$(sort $(WILD))"
FILES := soft:ugly soft:butt/ugly soft:butt/ugly/slime
DIRS := $(dir $(FILES))
NOTDIRS := $(notdir $(FILES))
JOINSTR := $(join $(DIRS),$(NOTDIRS))
testdir:
@echo "$(FILES)"
@echo "$(DIRS)"
@echo "$(NOTDIRS)"
@echo "$(JOINSTR)"
cd subdir
list
LIST1 := a.a b.b c.c d.d e.e f.f g.g h.h i.i j.j k.k
LIST2 := $(suffix $(LIST1))
LIST3 := $(join $(BASE),$(LIST2))
testlist:
@echo "$(LIST2)"
@echo "$(LIST3)"
finger := my toe hurts
bleh:
# test a conditional
if eq($(DOIT),yes)
@echo "DOIT=yes; hurray!"
else
@echo "DOIT=$(DOIT)"
endif
echo "$(ugh) $(findstring hello,my hello) $(strip $(finger))"
MONSTER := a.b a.c b.b b.c
BEES := $(filter %.b,$(MONSTER))
CEES := $(filter %.c,$(MONSTER))
NOTB := $(filter-out %.b,$(MONSTER))
NOTC := $(filter-out %.c,$(MONSTER))
# Now for a real-live generic rule that will make a.out
# from any .c files in your current directory! Neat huh?
# Just change a.out to your favourite file name for the binary.
a.out: $(OBJS)
$(CC) -o $@ $(CFLAGS) $(OBJS) $(LIBS)